﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFP;
using SFP.Audio;
using SFP.CollisionDetection;
using HamsterDelivery.LevelStructure;
using HamsterDelivery.LevelStructure.GameObjects;

namespace HamsterDelivery.LevelStructure.Reactions
{
    public class LetterReaction : Reaction
    {
        private HamsterGame game;

        public LetterReaction(HamsterGame game)
        {
            this.game = game;
        }

        private void collectLetter(CollisionInfo collisionInfo)
        {
            LetterObject letter = (LetterObject)collisionInfo.GameObject;

            if (letter.Jumping)
                return;

            game.Level.removeGameObject(collisionInfo.GameObject, Level.MAIN_LAYER, game.Level.Letters);
            game.LetterScore++;

            AudioPlayer.play(Resources.A_COIN_SOUND, true);
        }

        protected override void fromBeneath(CollisionInfo collisionInfo)
        {
            collectLetter(collisionInfo);
        }

        protected override void fromAbove(CollisionInfo collisionInfo)
        {
            collectLetter(collisionInfo);
        }

        protected override void fromLeft(CollisionInfo collisionInfo)
        {
            collectLetter(collisionInfo);
        }

        protected override void fromRight(CollisionInfo collisionInfo)
        {
            collectLetter(collisionInfo);
        }

        protected override void touchesTop(CollisionInfo collisionInfo)
        {
        }

        protected override void touchesBottom(CollisionInfo collisionInfo)
        {
        }

        protected override void touchesLeft(CollisionInfo collisionInfo)
        {
        }

        protected override void touchesRight(CollisionInfo collisionInfo)
        {
        }
    }
}
